Some computer programming environments support “virtual routines” whose behavior can be defined dynamically at runtime and/or can be overridden by another routine which has the same signature. A routine's signature defines criteria such as the parameters the routine expects, if any, and the type of value (if any) that is returned by the routine.
Programming languages use various approaches to implement virtual routines. One approach uses a vtable data structure, which is also known variously as a virtual routine table, virtual method table, virtual function table, virtual call table, dispatch table, function dispatch table, virtual table, or v-table structure. These terms for vtable are used interchangeably herein, with the understanding that vtables can vary considerably from one another in terms of layout, content, language and other standards compatibility, and functionality, for example. But in general, a vtable data structure contains pointers to the code that currently implements one or more virtual routines. A given virtual routine can then be defined dynamically and/or be overridden, e.g., by creating a new vtable with a different value for that virtual routine's pointer, and by setting a vtable pointer to this new modified vtable. The previous vtable itself is not necessarily changed at runtime, and in some implementations is stored in read-only pages of memory.